home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: Mailbox/MIME Entity
(archive/mbox).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| Mailbox/MIME Entity (archive/mbox)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| ASCII text
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/950 MIME Email (1.0)
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 4e 65 77 73 67 72 6f 75 | 70 73 3a 20 63 6f 6d 70 |Newsgrou|ps: comp|
|00000010| 2e 6c 61 6e 67 2e 63 2b | 2b 0a 50 61 74 68 3a 20 |.lang.c+|+.Path: |
|00000020| 6e 65 77 73 2e 6e 65 72 | 2e 62 62 6e 70 6c 61 6e |news.ner|.bbnplan|
|00000030| 65 74 2e 6e 65 74 21 61 | 72 63 6f 21 75 73 65 6e |et.net!a|rco!usen|
|00000040| 65 74 0a 46 72 6f 6d 3a | 20 42 72 69 61 6e 20 4c |et.From:| Brian L|
|00000050| 65 61 63 68 20 3c 6c 61 | 73 62 66 6c 3e 0a 53 75 |each <la|sbfl>.Su|
|00000060| 62 6a 65 63 74 3a 20 52 | 65 3a 20 64 79 6e 61 6d |bject: R|e: dynam|
|00000070| 69 63 20 6d 65 6d 6f 72 | 79 20 61 6c 6c 6f 63 61 |ic memor|y alloca|
|00000080| 74 69 6f 6e 0a 58 2d 4e | 6e 74 70 2d 50 6f 73 74 |tion.X-N|ntp-Post|
|00000090| 69 6e 67 2d 48 6f 73 74 | 3a 20 31 33 36 2e 32 32 |ing-Host|: 136.22|
|000000a0| 36 2e 31 31 36 2e 31 0a | 43 6f 6e 74 65 6e 74 2d |6.116.1.|Content-|
|000000b0| 54 79 70 65 3a 20 74 65 | 78 74 2f 70 6c 61 69 6e |Type: te|xt/plain|
|000000c0| 3b 20 63 68 61 72 73 65 | 74 3d 75 73 2d 61 73 63 |; charse|t=us-asc|
|000000d0| 69 69 0a 4d 65 73 73 61 | 67 65 2d 49 44 3a 20 3c |ii.Messa|ge-ID: <|
|000000e0| 44 4d 30 47 33 35 2e 41 | 4b 72 40 6e 65 77 73 2e |DM0G35.A|Kr@news.|
|000000f0| 61 72 63 6f 2e 63 6f 6d | 3e 0a 54 6f 3a 20 6c 75 |arco.com|>.To: lu|
|00000100| 63 69 61 6e 6f 40 67 6e | 6f 6d 69 63 2e 73 74 61 |ciano@gn|omic.sta|
|00000110| 6e 66 6f 72 64 2e 65 64 | 75 0a 53 65 6e 64 65 72 |nford.ed|u.Sender|
|00000120| 3a 20 75 73 65 6e 65 74 | 40 6e 65 77 73 2e 61 72 |: usenet|@news.ar|
|00000130| 63 6f 2e 63 6f 6d 0a 43 | 6f 6e 74 65 6e 74 2d 54 |co.com.C|ontent-T|
|00000140| 72 61 6e 73 66 65 72 2d | 45 6e 63 6f 64 69 6e 67 |ransfer-|Encoding|
|00000150| 3a 20 37 62 69 74 0a 4f | 72 67 61 6e 69 7a 61 74 |: 7bit.O|rganizat|
|00000160| 69 6f 6e 3a 20 41 52 43 | 4f 20 4f 69 6c 20 25 20 |ion: ARC|O Oil % |
|00000170| 47 61 73 20 43 6f 6d 70 | 61 6e 79 0a 52 65 66 65 |Gas Comp|any.Refe|
|00000180| 72 65 6e 63 65 73 3a 20 | 3c 33 31 30 41 42 44 38 |rences: |<310ABD8|
|00000190| 39 2e 35 35 33 37 40 67 | 6e 6f 6d 69 63 2e 73 74 |9.5537@g|nomic.st|
|000001a0| 61 6e 66 6f 72 64 2e 65 | 64 75 3e 0a 4d 69 6d 65 |anford.e|du>.Mime|
|000001b0| 2d 56 65 72 73 69 6f 6e | 3a 20 31 2e 30 0a 44 61 |-Version|: 1.0.Da|
|000001c0| 74 65 3a 20 54 75 65 2c | 20 33 30 20 4a 61 6e 20 |te: Tue,| 30 Jan |
|000001d0| 31 39 39 36 20 32 30 3a | 31 31 3a 32 39 20 47 4d |1996 20:|11:29 GM|
|000001e0| 54 0a 58 2d 4d 61 69 6c | 65 72 3a 20 4d 6f 7a 69 |T.X-Mail|er: Mozi|
|000001f0| 6c 6c 61 20 31 2e 31 4e | 20 28 58 31 31 3b 20 49 |lla 1.1N| (X11; I|
|00000200| 3b 20 48 50 2d 55 58 20 | 41 2e 30 39 2e 30 35 20 |; HP-UX |A.09.05 |
|00000210| 39 30 30 30 2f 37 35 35 | 29 0a 58 2d 55 72 6c 3a |9000/755|).X-Url:|
|00000220| 20 6e 65 77 73 3a 33 31 | 30 41 42 44 38 39 2e 35 | news:31|0ABD89.5|
|00000230| 35 33 37 40 67 6e 6f 6d | 69 63 2e 73 74 61 6e 66 |537@gnom|ic.stanf|
|00000240| 6f 72 64 2e 65 64 75 0a | 0a 4c 75 63 69 61 6e 6f |ord.edu.|.Luciano|
|00000250| 20 42 72 6f 63 63 68 69 | 65 72 69 20 3c 6c 75 63 | Brocchi|eri <luc|
|00000260| 69 61 6e 6f 40 67 6e 6f | 6d 69 63 2e 73 74 61 6e |iano@gno|mic.stan|
|00000270| 66 6f 72 64 2e 65 64 75 | 3e 20 77 72 6f 74 65 3a |ford.edu|> wrote:|
|00000280| 0a 3e 46 72 6f 6d 20 6d | 61 69 6e 20 49 20 61 6d |.>From m|ain I am|
|00000290| 20 70 61 73 73 69 6e 67 | 20 61 20 70 6f 69 6e 74 | passing| a point|
|000002a0| 65 72 20 69 6e 74 20 2a | 70 20 74 6f 20 61 20 66 |er int *|p to a f|
|000002b0| 75 6e 63 74 69 6f 6e 20 | 66 75 6e 63 74 69 6f 6e |unction |function|
|000002c0| 28 70 2c 26 6e 29 0a 3e | 77 68 69 63 68 20 61 6c |(p,&n).>|which al|
|000002d0| 6c 6f 63 61 74 65 73 20 | 6d 65 6d 6f 72 79 20 74 |locates |memory t|
|000002e0| 6f 20 69 74 3a 0a 3e 70 | 3d 28 69 6e 74 20 2a 29 |o it:.>p|=(int *)|
|000002f0| 6d 61 6c 6c 6f 63 28 6e | 2c 73 69 7a 65 6f 66 28 |malloc(n|,sizeof(|
|00000300| 69 6e 74 29 29 3b 0a 3e | 4d 79 20 70 72 6f 62 6c |int));.>|My probl|
|00000310| 65 6d 20 69 73 3a 20 68 | 6f 77 20 64 6f 20 49 20 |em is: h|ow do I |
|00000320| 6c 65 74 20 6d 61 69 6e | 20 6b 6e 6f 77 20 6f 66 |let main| know of|
|00000330| 20 74 68 65 20 65 78 69 | 73 74 65 6e 63 65 20 6f | the exi|stence o|
|00000340| 66 20 74 68 65 0a 3e 61 | 6c 6c 6f 63 61 74 65 64 |f the.>a|llocated|
|00000350| 20 6d 65 6d 6f 72 79 3f | 20 4d 79 20 73 6f 6c 75 | memory?| My solu|
|00000360| 74 69 6f 6e 20 69 73 20 | 77 72 69 74 69 6e 67 20 |tion is |writing |
|00000370| 69 6e 20 6d 61 69 6e 3a | 0a 3e 70 3d 28 69 6e 74 |in main:|.>p=(int|
|00000380| 20 2a 29 72 65 61 6c 6c | 6f 63 28 70 2c 6e 2a 73 | *)reall|oc(p,n*s|
|00000390| 69 7a 65 6f 66 28 69 6e | 74 29 29 3b 0a 3e 72 69 |izeof(in|t));.>ri|
|000003a0| 67 68 74 20 61 66 74 65 | 72 20 74 68 65 20 66 75 |ght afte|r the fu|
|000003b0| 6e 63 74 69 6f 6e 20 63 | 61 6c 6c 2c 20 62 65 66 |nction c|all, bef|
|000003c0| 6f 72 65 20 73 6f 6d 65 | 74 68 69 6e 67 20 65 6c |ore some|thing el|
|000003d0| 73 65 20 67 65 74 73 20 | 77 72 69 74 74 65 6e 0a |se gets |written.|
|000003e0| 3e 6f 6e 20 69 74 2c 20 | 77 68 69 63 68 2c 20 74 |>on it, |which, t|
|000003f0| 68 6f 75 67 68 20 65 66 | 66 65 63 74 69 76 65 2c |hough ef|fective,|
|00000400| 20 64 6f 65 73 6e 27 74 | 20 73 65 65 6d 20 76 65 | doesn't| seem ve|
|00000410| 72 79 20 65 6c 65 67 61 | 6e 74 2e 20 42 65 73 69 |ry elega|nt. Besi|
|00000420| 64 65 73 2c 20 0a 3e 66 | 75 6e 63 74 69 6f 6e 73 |des, .>f|unctions|
|00000430| 20 6c 69 6b 65 20 6d 61 | 6c 6c 6f 63 28 29 2c 20 | like ma|lloc(), |
|00000440| 73 74 72 64 75 70 28 29 | 2c 20 65 74 63 2e 2c 20 |strdup()|, etc., |
|00000450| 73 65 65 6d 20 74 6f 20 | 62 65 20 61 62 6c 65 20 |seem to |be able |
|00000460| 74 6f 20 6c 65 74 20 0a | 3e 74 68 65 20 63 61 6c |to let .|>the cal|
|00000470| 6c 69 6e 67 20 66 75 6e | 63 74 69 6f 6e 20 6b 6e |ling fun|ction kn|
|00000480| 6f 77 20 6f 66 20 74 68 | 65 20 61 6c 6c 6f 63 61 |ow of th|e alloca|
|00000490| 74 65 64 20 6d 65 6d 6f | 72 79 2e 20 57 68 61 74 |ted memo|ry. What|
|000004a0| 20 69 73 20 74 68 65 20 | 0a 3e 72 69 67 68 74 20 | is the |.>right |
|000004b0| 70 72 6f 63 65 64 75 72 | 65 3f 20 41 6e 79 20 73 |procedur|e? Any s|
|000004c0| 75 67 67 65 73 74 69 6f | 6e 20 77 69 6c 6c 20 62 |uggestio|n will b|
|000004d0| 65 20 67 72 65 61 74 6c | 79 20 61 70 70 72 65 63 |e greatl|y apprec|
|000004e0| 69 61 74 65 64 2e 20 0a | 3e 54 68 61 6e 6b 73 20 |iated. .|>Thanks |
|000004f0| 61 20 6c 6f 74 2c 0a 3e | 0a 3e 4c 75 63 69 61 6e |a lot,.>|.>Lucian|
|00000500| 6f 20 42 72 6f 63 63 68 | 69 65 72 69 0a 3e 6c 75 |o Brocch|ieri.>lu|
|00000510| 63 69 61 6e 6f 40 67 6e | 6f 6d 69 63 2e 73 74 61 |ciano@gn|omic.sta|
|00000520| 6e 66 6f 72 64 2e 65 64 | 75 0a 0a 0a 4c 75 63 69 |nford.ed|u...Luci|
|00000530| 61 6e 6f 2c 0a 0a 41 20 | 63 6f 75 70 6c 65 20 6f |ano,..A |couple o|
|00000540| 66 20 74 68 69 6e 67 73 | 20 6d 69 67 68 74 20 62 |f things| might b|
|00000550| 65 20 6f 66 20 68 65 6c | 70 20 74 6f 20 79 6f 75 |e of hel|p to you|
|00000560| 3a 0a 0a 31 29 20 50 61 | 73 73 20 65 69 74 68 65 |:..1) Pa|ss eithe|
|00000570| 72 20 61 20 70 6f 69 6e | 74 65 72 20 74 6f 20 61 |r a poin|ter to a|
|00000580| 20 70 6f 69 6e 74 65 72 | 2c 20 74 68 65 6e 20 64 | pointer|, then d|
|00000590| 65 2d 72 65 66 65 72 65 | 6e 63 65 20 66 6f 72 20 |e-refere|nce for |
|000005a0| 74 68 65 20 6d 61 6c 6c | 6f 63 3a 0a 20 20 20 76 |the mall|oc:. v|
|000005b0| 6f 69 64 20 61 6c 6c 6f | 63 46 75 6e 63 28 20 76 |oid allo|cFunc( v|
|000005c0| 6f 69 64 20 2a 2a 70 2c | 20 73 69 7a 65 5f 74 20 |oid **p,| size_t |
|000005d0| 6e 20 29 20 7b 20 2a 70 | 20 3d 20 6d 61 6c 6c 6f |n ) { *p| = mallo|
|000005e0| 63 28 20 6e 20 29 3b 20 | 7d 0a 49 6e 76 6f 6b 65 |c( n ); |}.Invoke|
|000005f0| 20 61 73 3a 0a 20 20 20 | 20 76 6f 69 64 20 2a 70 | as:. | void *p|
|00000600| 74 72 3b 0a 20 20 20 20 | 61 6c 6c 6f 63 46 75 6e |tr;. |allocFun|
|00000610| 63 28 20 26 70 74 72 2c | 20 32 30 20 29 3b 0a 0a |c( &ptr,| 20 );..|
|00000620| 4f 72 20 79 6f 75 20 63 | 61 6e 20 70 61 73 73 20 |Or you c|an pass |
|00000630| 61 20 72 65 66 65 72 65 | 6e 63 65 20 74 6f 20 61 |a refere|nce to a|
|00000640| 20 70 6f 69 6e 74 65 72 | 3a 0a 20 20 20 20 76 6f | pointer|:. vo|
|00000650| 69 64 20 61 6c 6c 6f 63 | 66 75 6e 63 28 20 76 6f |id alloc|func( vo|
|00000660| 69 64 20 26 2a 70 2c 20 | 73 69 7a 65 5f 74 20 6e |id &*p, |size_t n|
|00000670| 29 20 7b 20 70 20 3d 20 | 6d 61 6c 6c 6f 63 28 20 |) { p = |malloc( |
|00000680| 6e 20 29 3b 20 7d 0a 49 | 6e 76 6f 6b 65 20 61 73 |n ); }.I|nvoke as|
|00000690| 0a 20 20 20 20 76 6f 69 | 64 20 2a 70 74 72 3b 0a |. voi|d *ptr;.|
|000006a0| 20 20 20 20 61 6c 6c 6f | 63 66 75 6e 63 28 20 70 | allo|cfunc( p|
|000006b0| 74 72 2c 20 32 30 20 29 | 3b 0a 0a 49 6e 20 62 6f |tr, 20 )|;..In bo|
|000006c0| 74 68 20 6f 66 20 74 68 | 65 73 65 20 65 78 61 6d |th of th|ese exam|
|000006d0| 70 6c 65 73 2c 20 74 68 | 65 20 76 61 6c 75 65 20 |ples, th|e value |
|000006e0| 6f 66 20 70 74 72 20 69 | 6e 20 74 68 65 20 63 61 |of ptr i|n the ca|
|000006f0| 6c 6c 69 6e 67 20 6d 6f | 64 75 6c 65 20 77 69 6c |lling mo|dule wil|
|00000700| 6c 20 72 65 66 6c 65 63 | 74 0a 74 68 65 20 72 65 |l reflec|t.the re|
|00000710| 73 75 6c 74 73 20 6f 66 | 20 74 68 65 20 6d 61 6c |sults of| the mal|
|00000720| 6c 6f 63 2e 0a 0a 32 29 | 20 49 20 77 6f 75 6c 64 |loc...2)| I would|
|00000730| 20 73 74 72 6f 6e 67 6c | 79 20 65 6e 63 6f 75 72 | strongl|y encour|
|00000740| 61 67 65 20 79 6f 75 20 | 74 6f 20 75 73 65 20 27 |age you |to use '|
|00000750| 6e 65 77 27 20 61 6e 64 | 20 27 64 65 6c 65 74 65 |new' and| 'delete|
|00000760| 27 20 72 61 74 68 65 72 | 20 74 68 61 6e 0a 27 6d |' rather| than.'m|
|00000770| 61 6c 6c 6f 63 27 0a 61 | 6e 64 20 27 66 72 65 65 |alloc'.a|nd 'free|
|00000780| 27 2e 20 54 68 65 72 65 | 20 61 72 65 20 6d 61 6e |'. There| are man|
|00000790| 79 20 75 73 65 66 75 6c | 20 74 68 69 6e 67 73 20 |y useful| things |
|000007a0| 77 68 69 63 68 20 63 61 | 6e 20 62 79 20 6f 76 65 |which ca|n by ove|
|000007b0| 72 6c 6f 61 64 69 6e 67 | 20 74 68 65 73 65 0a 6b |rloading| these.k|
|000007c0| 65 79 77 6f 72 64 73 0a | 77 68 69 63 68 20 61 72 |eywords.|which ar|
|000007d0| 65 20 6d 75 63 68 20 6d | 6f 72 65 20 64 69 66 66 |e much m|ore diff|
|000007e0| 69 63 75 6c 74 20 74 6f | 20 61 63 63 6f 6d 70 6c |icult to| accompl|
|000007f0| 69 73 68 20 77 69 74 68 | 20 74 68 65 20 63 20 73 |ish with| the c s|
|00000800| 74 79 6c 65 20 66 75 6e | 63 74 69 6f 6e 73 2e 0a |tyle fun|ctions..|
|00000810| 0a 2d 42 72 69 61 6e 20 | 3a 2d 29 0a 0a |.-Brian |:-).. |
+--------+-------------------------+-------------------------+--------+--------+